package enums.table;

import java.util.ArrayList;
import java.util.List;

/**
 * 类的类型
 */
public enum ClazzTypeEnum {
	Entity ("", ""),
	VO ("Vo", ""),
	QUERY ("Query", ""),
	DTO ("Dto", ""),
	SERVICE ("Service", ""),
	SERVICECONTROLLER ("ServiceController", ""),
	SERVICEIMPL ("ServiceImpl", ""),
	DAO ("Dao", ""),
	MAPPER ("mapper", ""),
	;

	// 类后缀
	private String suffix;
	// 备注
	private String remark;

	private ClazzTypeEnum(String suffix, String remark) {
		this.suffix = suffix;
		this.remark = remark;
	}

	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * 获取枚举 List 集合
	 */
	public static List<ClazzTypeEnum> getEnumList() {
		List<ClazzTypeEnum> list = new ArrayList<>();
		for (ClazzTypeEnum clazzTypeEnum : ClazzTypeEnum.values()) {
			list.add(clazzTypeEnum);
		}
		return list;
	}

	public static boolean isInterface(String code) {
		if (code == null || code.equals("")) {
			return false;
		}
		List<String> list = new ArrayList<>();
		list.add(ClazzTypeEnum.SERVICE.getSuffix());
		list.add(ClazzTypeEnum.DAO.getSuffix());
		return list.contains(code);
	}

	public static boolean isEntity(String code) {
		if (code == null) {
			return false;
		}
		List<String> list = new ArrayList<>();
		list.add(ClazzTypeEnum.Entity.getSuffix());
		list.add(ClazzTypeEnum.VO.getSuffix());
		list.add(ClazzTypeEnum.QUERY.getSuffix());
		list.add(ClazzTypeEnum.DTO.getSuffix());
		return list.contains(code);
	}

	public static boolean isExtends(String code) {
		if (code == null) {
			return false;
		}
		List<String> list = new ArrayList<>();
		list.add(ClazzTypeEnum.VO.getSuffix());
		list.add(ClazzTypeEnum.QUERY.getSuffix());
		list.add(ClazzTypeEnum.DTO.getSuffix());
		return list.contains(code);
	}
}
